count = 0
num_len = 1
while 9 ** num_len > 10 ** (num_len - 1):
    for i in range(1, 10):
        if len(str(i ** num_len)) == num_len:
            count += 1
    num_len += 1
print(count)
